import React, { Component } from 'react'

class Item extends Component {

    constructor (props) {
        super(props)
        this.handleClick = this.handleClick.bind(this)
    }

    render () {
        const { item } = this.props
        return (
            <li onClick={this.handleClick}>{item}</li>
        )
       
    }

    handleClick () {
         const {itemClick, index} = this.props
         itemClick(index)
    }

}

export default Item